package com.example.demo.controller;

import com.example.demo.config.UserConfiguration;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

@Controller
public class UserController2 {
    //构造方法注入

    private UserService userService;
    private UserConfiguration userConfiguration;

    public UserController2(){

    }
    @Autowired
    public UserController2(UserService userService,UserConfiguration configuration){
        this.userService=userService;
        this.userConfiguration = configuration;
    }

//    public UserController2(UserConfiguration configuration) {
//        this.userConfiguration = configuration;
//    }

    public void hi(){
        userConfiguration.sayHi();
        userService.sayHi();
        System.out.println("hi,UserController2");
        System.out.println("------------------");
    }

}
